package org.jactao.rpc;

import org.jactao.common.LClientConfig;
import org.jactao.common.LServerConfig;

import java.util.concurrent.ConcurrentHashMap;

/**
 * Created by fanzetao on 2018/4/4.
 */
public class LContainer {

    private static LContainer container = new LContainer();

    private LContainer() {}

    public static LContainer getInstance() {
        return container;
    }

    //className -> serviceImpl
    private ConcurrentHashMap<String, Object> services = new ConcurrentHashMap<>();

    public void putService(String serviceName, Object serviceImpl) {
        services.put(serviceName, serviceImpl);
    }

    public Object getService(String serviceName) {
        return services.get(serviceName);
    }

    //config beans
    private LClientConfig clientConfig;

    private LServerConfig serverConfig;

    public LClientConfig getClientConfig() {
        return clientConfig;
    }

    public void setClientConfig(LClientConfig clientConfig) {
        this.clientConfig = clientConfig;
    }

    public LServerConfig getServerConfig() {
        return serverConfig;
    }

    public void setServerConfig(LServerConfig serverConfig) {
        this.serverConfig = serverConfig;
    }
}
